home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / rexx / xdmd1.lha / AlignHeading.xdme < prev    next >
Text File  |  1994-10-29  |  863b  |  30 lines

  1. /* AlignHeading.xdme © 1994 Fergus Duniho */
  2. /* Aligns the current outline heading under the present heading */
  3.  
  4. 'first while !r up up while !r up if !t down'
  5. address 'XDME.1'
  6. options results
  7. 'rxresult $currentline'
  8. LINE = result
  9. POSITION = Verify(LINE,'.)',m)
  10. LEVEL = (POSITION - 9)%4 + 1
  11. HEADING = Word(LINE,1)
  12. ALPHANUM = Left(HEADING,Length(HEADING)-1)
  13.  
  14. Select
  15.     When LEVEL = 1 Then ALPHANUM = UPPER(Roman(Arabic(ALPHANUM) + 1))
  16.     When LEVEL = 2 | LEVEL = 4 | LEVEL = 7 Then ALPHANUM = d2c(c2d(ALPHANUM) + 1)
  17.     When LEVEL = 3 | LEVEL = 6 Then ALPHANUM = ALPHANUM + 1
  18.     When LEVEL = 5 | LEVEL = 8 Then ALPHANUM = (Roman(Arabic(ALPHANUM) + 1))
  19.     Otherwise NOP
  20. End
  21.  
  22. 'while !r down'
  23. wright
  24. LINE = "'" Copies(' ',POSITION-(Length(ALPHANUM)+3)) ALPHANUM || Right(HEADING,1) ' ' Strip(Delword(Strip(Extract()),1,1))
  25. first
  26. remeol
  27. LINE
  28. C = 'col' POSITION+4
  29. C
  30.